﻿// Copyright 2008 Chris Varley (http://www.contractdriven.net/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using ContractDriven.CommonAssertions;
using NUnit.Framework;
using Assert = NUnit.Framework.Assert;

namespace ContractDrivenTests.CommonAssertions
{
    #region Equal Assertion Tests
    [TestFixture, Description("Tests for EqualAssertion Class")]
    public class EqualAssertionTest
    {

        [Test]
        public void EqualAssertionConstructorTest()
        {
            var assertion = new EqualAssertion<int>(1, 1);
            Assert.IsNotNull(assertion);
        }

        #region Eval Method Tests

        [Test]
        public void EvalIntegerEqualTest()
        {
            var assertion = new EqualAssertion<int>(1, 1);
            Assert.IsTrue(assertion.Eval(), "EqualAssertion.Eval failed. an equal condition was incorrectly evaluated.");
        }

        [Test]
        public void EvalIntegerNotEqualTest()
        {
            var assertion = new EqualAssertion<int>(1, 2);
            Assert.IsFalse(assertion.Eval(), "EqualAssertion.Eval failed. a non equal condition was incorrectly evaluatede.");
        }

        [Test]
        public void EvalStringEqualTest()
        {
            var assertion = new EqualAssertion<string>("thomas", "thomas");
            Assert.IsTrue(assertion.Eval(), "EqualAssertion.Eval failed. an equal condition was incorrectly evaluated.");
        }

        [Test]
        public void EvalStringNotEqualTest()
        {
            var assertion = new EqualAssertion<string>("thomas", "tam");
            Assert.IsFalse(assertion.Eval(), "EqualAssertion.Eval failed. a non equal condition was incorrectly evaluatede.");
        }

        #endregion



    }
    #endregion
    #region Not Equal Assetion Tests
    [TestFixture, Description("Tests for NotEqualAssertion Class")]
    public class NotEqualAssertionTest
    {

        [Test]
        public void NotEqualAssertionConstructorTest()
        {
            var assertion = new NotEqualAssertion<int>(1,2);
            Assert.IsNotNull(assertion);
        }

        #region Eval Method Tests

        [Test]
        public void EvalIntegerNotEqualTest()
        {
            var assertion = new NotEqualAssertion<int>(1,2);
            Assert.IsTrue(assertion.Eval(), "NotEqualAssertion.Eval failed. a non equal condition was incorrectly evaluated.");
        }

        [Test]
        public void EvalIntegerEqualTest()
        {
            var assertion = new NotEqualAssertion<int>(1,1);
            Assert.IsFalse(assertion.Eval(), "NotEqualAssertion.Eval failed. an equal condition was incorrectly evaluated.");
        }

        #endregion

    }
    #endregion
}
